﻿
using SailHero.Soft.FrameWork.DomainRepositories;
using SailHero.Soft.FrameWork.Models;

namespace UI.Web.SL.Demo.RIAServices.Web
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data;
    using System.Linq;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;


    // 使用 SysAdminEntities 上下文实现应用程序逻辑。
    //还可考虑添加角色，以根据需要限制访问。
    // [RequiresAuthentication]
    [EnableClientAccess()]
    public class SysAdminDService : DomainService
    {
        private SysAdminRepository _bllSysAdmin = new SysAdminRepository();
        [Insert]
        public void Add(MenuInfo meninfo)
        {
            _bllSysAdmin.Add(meninfo);
            _bllSysAdmin.UnitOfWork.SaveChanges();
        }
        [Update]
        public void Update(MenuInfo meninfo)
        {
            _bllSysAdmin.Update(meninfo);
        }

        [Delete]
        public void Delete(MenuInfo meninfo)
        {
            _bllSysAdmin.Delete(meninfo);
            _bllSysAdmin.UnitOfWork.SaveChanges();
        }

        [Query]
        public List<MenuInfo> GetMenus()
        {
            return _bllSysAdmin.GetMenus();
        }
    }
}


